-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor LSRA's heuristics selection #52832
Conversation
|
- summary docs - Removed DEFAULT_ORDER - Added order seq ID
@dotnet/jit-contrib |
jitstressregs failure is related to #52945 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be some confusion between regMaskTP/RBM_NONE and regNumber/REG_NA. You don't want to return REG_NA from a function defined to return regMaskTP.
I presume most of the code is just refactored/moved.
// Apply a simple mask-based selection heuristic, and return 'true' if we now have a single candidate. | ||
bool applySelection(int selectionScore, regMaskTP selectionCandidates DEBUG_ARG(RegisterScore* registerScore)) | ||
// Perform register selection and update currentInterval or refPosition TODO: | ||
FORCEINLINE regMaskTP select(Interval* currentInterval, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are all the FORCEINLINE
really necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allocateReg
is a hot method and I didn't want to add function call cost to it so marked everything FORCEINLINE
. Is there a downside that you see with it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose it's ok if it's really necessary because it's known to be hot.
src/coreclr/jit/lsra.cpp
Outdated
} | ||
} | ||
} | ||
else if (r |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix/remove TODO
src/coreclr/jit/lsra.cpp
Outdated
} | ||
} | ||
} | ||
else if (r |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: fix or remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the reference line of your comment. Can you copy/paste the text where you see the leftover TODO?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think all the ones I flagged had your alias, so just search for that.
Refactor register selection
allocateReg()
method so that the selection heuristics can be applied in different and dynamic order instead of hardcoded and sequential. SinceallocateReg()
operates on local method variables, I had to writeRegisterSelection
class that contains all the register selection related variables.select()
method would do the register selection. Most of the changes are moving around the existing code inallocateReg()
to its own separate methods ofRegisterSelection
class.For now, the ordering is not changed, but in
DEBUG
, I have included aCOMPlu_
variable thatLsraOrdering
that will let the user set the ordering. It takes charactersA
thruQ
and each character corresponds to a heuristics. InDEBUG
the heuristics will be applied based on the provided sequence toLsraOrdering
.There are no asmdiffs with this change.
I did throughput analysis of this change using pin and do not see any impact. All the diffs are within the the error range.
Pin numbers
Windows x64
More data
More data
Windows arm64
More data
More data
Windows x86
More data
More data
Linux arm
More data
Contributes to #43318